package com.ajax.serice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/ajaxrequest3")
public class AjaxRequest3Servlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       request.setCharacterEncoding("utf-8");
        //设置相应的内容类型以及字符集
        response.setContentType("text/html;charset=UTF-8");
        //获取响音流
        PrintWriter out = response.getWriter();
        //响应
        //out.print("JSON  HTML");
        //out.print("<font color='red'>用户名已存在！！！！1</font>");

        //获取 Ajax get 请求提交数据
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        out.print("用户名："+username+"密码："+password);


    }
}
